package ar.com.sebasoft.rembrandt.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.Log;
import ar.com.sebasoft.rembrandt.fragment.FullscreenArrayFragment;
import ar.com.sebasoft.rembrandt.model.Foto;
import ar.com.sebasoft.rembrandt.util.SystemHelper;

/**
 * @author SebaSOFT
 * 
 */
public class WebViewPagerAdapter extends FragmentStatePagerAdapter {

	private List<Foto> items;

	public WebViewPagerAdapter(FragmentManager fm, List<Foto> items) {
		super(fm);
		this.items = items;
		FullscreenArrayFragment.evictCache();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.support.v4.app.FragmentStatePagerAdapter#getItem(int)
	 */
	@Override
	public Fragment getItem(int position) {
		Log.v(SystemHelper.APP_TAG, "WebViewPagerAdapter - getItem(" + position + ")");
		return FullscreenArrayFragment.newInstance(position, this.items);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.support.v4.view.PagerAdapter#getCount()
	 */
	@Override
	public int getCount() {
		return this.items.size();
	}

}
